//
//  OSSResource.swift
//  TTCoreData
//
//  Created by Toj on 4/13/21.
//

import Foundation

open class OSSResource: NSObject {
    
    public var endpoint = ""
    
    public var serverUrl = ""
    
    public var accessKey = ""
    public var secretKey = ""
    public var token = ""
    public var expiration = ""
    
    public var bucketName = ""
    
    public var keyPath = ""
    public var ossFileName = ""
    
    public var fromURL = ""
    public var toURL = ""
    
}

public extension OSSResource {
    var objectKey: String {
        var objKey = keyPath
        if  ossFileName.count > 0 &&
            !objKey.hasSuffix(ossFileName) {
            objKey.tt_append(path: ossFileName)
        }
        return objKey
    }
}
